package com.spring.security.web.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.spring.activemq.model.BaseJms;
import com.spring.activemq.producer.TopicSender;
import com.spring.iosservice.web.model.CourseMtsInfo;
import com.spring.security.core.context.JmsContext;
import com.spring.security.web.dao.JedisCache;
import com.spring.security.web.model.Log;
import com.spring.security.web.service.MessageProvider;

@Service
public class MessageProviderImpl implements MessageProvider{
	
	@Resource private JedisCache jedisCache;
	
	@Resource private TopicSender topicSender;

	@Override
	public void emailProvider(Log log) {
		topicSender.sendObject(JmsContext.EXCEPTION_JMS_MAIL_MQ, log);
//		topicSender.send(JmsContext.EXCEPTION_JMS_MAIL_MQ, JmsContext.EXCEPTION_JMS_MAIL);
//		jedisCache.lpush(JmsContext.EXCEPTION_JMS_MAIL.getBytes(),ObjectUtils.serialize(entity));
	}

	@Override
	public void objectProvider(BaseJms baseJms) {
		topicSender.sendObject(JmsContext.OBJECT_JMS_MQ, baseJms);
	}
	
	@Override
	public void mtsProvider(CourseMtsInfo courseMtsInfo) {
		topicSender.sendObject(JmsContext.MTS_MQ, courseMtsInfo);
	}
}
